home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Doc / libexcs.tex < prev    next >
LaTeX Document  |  1994-01-02  |  7.2 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: libexcs.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 45 78 63 65 70 74 | 69 6f 6e 73 7d 0d 0d 45 |n Except|ions}..E|
|00000020| 78 63 65 70 74 69 6f 6e | 73 20 61 72 65 20 73 74 |xception|s are st|
|00000030| 72 69 6e 67 20 6f 62 6a | 65 63 74 73 2e 20 20 54 |ring obj|ects. T|
|00000040| 77 6f 20 64 69 73 74 69 | 6e 63 74 20 73 74 72 69 |wo disti|nct stri|
|00000050| 6e 67 20 6f 62 6a 65 63 | 74 73 20 77 69 74 68 20 |ng objec|ts with |
|00000060| 74 68 65 0d 73 61 6d 65 | 20 76 61 6c 75 65 20 61 |the.same| value a|
|00000070| 72 65 20 64 69 66 66 65 | 72 65 6e 74 20 65 78 63 |re diffe|rent exc|
|00000080| 65 70 74 69 6f 6e 73 2e | 20 20 54 68 69 73 20 69 |eptions.| This i|
|00000090| 73 20 64 6f 6e 65 20 74 | 6f 20 66 6f 72 63 65 20 |s done t|o force |
|000000a0| 70 72 6f 67 72 61 6d 6d | 65 72 73 0d 74 6f 20 75 |programm|ers.to u|
|000000b0| 73 65 20 65 78 63 65 70 | 74 69 6f 6e 20 6e 61 6d |se excep|tion nam|
|000000c0| 65 73 20 72 61 74 68 65 | 72 20 74 68 61 6e 20 74 |es rathe|r than t|
|000000d0| 68 65 69 72 20 73 74 72 | 69 6e 67 20 76 61 6c 75 |heir str|ing valu|
|000000e0| 65 20 77 68 65 6e 20 73 | 70 65 63 69 66 79 69 6e |e when s|pecifyin|
|000000f0| 67 0d 65 78 63 65 70 74 | 69 6f 6e 20 68 61 6e 64 |g.except|ion hand|
|00000100| 6c 65 72 73 2e 20 20 54 | 68 65 20 73 74 72 69 6e |lers. T|he strin|
|00000110| 67 20 76 61 6c 75 65 20 | 6f 66 20 61 6c 6c 20 62 |g value |of all b|
|00000120| 75 69 6c 74 2d 69 6e 20 | 65 78 63 65 70 74 69 6f |uilt-in |exceptio|
|00000130| 6e 73 20 69 73 0d 74 68 | 65 69 72 20 6e 61 6d 65 |ns is.th|eir name|
|00000140| 2c 20 62 75 74 20 74 68 | 69 73 20 69 73 20 6e 6f |, but th|is is no|
|00000150| 74 20 61 20 72 65 71 75 | 69 72 65 6d 65 6e 74 20 |t a requ|irement |
|00000160| 66 6f 72 20 75 73 65 72 | 2d 64 65 66 69 6e 65 64 |for user|-defined|
|00000170| 20 65 78 63 65 70 74 69 | 6f 6e 73 0d 6f 72 20 65 | excepti|ons.or e|
|00000180| 78 63 65 70 74 69 6f 6e | 73 20 64 65 66 69 6e 65 |xception|s define|
|00000190| 64 20 62 79 20 6c 69 62 | 72 61 72 79 20 6d 6f 64 |d by lib|rary mod|
|000001a0| 75 6c 65 73 2e 0d 0d 54 | 68 65 20 66 6f 6c 6c 6f |ules...T|he follo|
|000001b0| 77 69 6e 67 20 65 78 63 | 65 70 74 69 6f 6e 73 20 |wing exc|eptions |
|000001c0| 63 61 6e 20 62 65 20 67 | 65 6e 65 72 61 74 65 64 |can be g|enerated|
|000001d0| 20 62 79 20 74 68 65 20 | 69 6e 74 65 72 70 72 65 | by the |interpre|
|000001e0| 74 65 72 20 6f 72 0d 62 | 75 69 6c 74 2d 69 6e 20 |ter or.b|uilt-in |
|000001f0| 66 75 6e 63 74 69 6f 6e | 73 2e 20 20 45 78 63 65 |function|s. Exce|
|00000200| 70 74 20 77 68 65 72 65 | 20 6d 65 6e 74 69 6f 6e |pt where| mention|
|00000210| 65 64 2c 20 74 68 65 79 | 20 68 61 76 65 20 61 6e |ed, they| have an|
|00000220| 20 60 61 73 73 6f 63 69 | 61 74 65 64 0d 76 61 6c | `associ|ated.val|
|00000230| 75 65 27 20 69 6e 64 69 | 63 61 74 69 6e 67 20 74 |ue' indi|cating t|
|00000240| 68 65 20 64 65 74 61 69 | 6c 65 64 20 63 61 75 73 |he detai|led caus|
|00000250| 65 20 6f 66 20 74 68 65 | 20 65 72 72 6f 72 2e 20 |e of the| error. |
|00000260| 20 54 68 69 73 20 6d 61 | 79 20 62 65 20 61 0d 73 | This ma|y be a.s|
|00000270| 74 72 69 6e 67 20 6f 72 | 20 61 20 74 75 70 6c 65 |tring or| a tuple|
|00000280| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 73 65 76 65 | contain|ing seve|
|00000290| 72 61 6c 20 69 74 65 6d | 73 20 6f 66 20 69 6e 66 |ral item|s of inf|
|000002a0| 6f 72 6d 61 74 69 6f 6e | 20 28 65 2e 67 2e 2c 20 |ormation| (e.g., |
|000002b0| 61 6e 0d 65 72 72 6f 72 | 20 63 6f 64 65 20 61 6e |an.error| code an|
|000002c0| 64 20 61 20 73 74 72 69 | 6e 67 20 65 78 70 6c 61 |d a stri|ng expla|
|000002d0| 69 6e 69 6e 67 20 74 68 | 65 20 63 6f 64 65 29 2e |ining th|e code).|
|000002e0| 0d 0d 55 73 65 72 20 63 | 6f 64 65 20 63 61 6e 20 |..User c|ode can |
|000002f0| 72 61 69 73 65 20 62 75 | 69 6c 74 2d 69 6e 20 65 |raise bu|ilt-in e|
|00000300| 78 63 65 70 74 69 6f 6e | 73 2e 20 20 54 68 69 73 |xception|s. This|
|00000310| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 74 6f 20 | can be |used to |
|00000320| 74 65 73 74 20 61 6e 0d | 65 78 63 65 70 74 69 6f |test an.|exceptio|
|00000330| 6e 20 68 61 6e 64 6c 65 | 72 20 6f 72 20 74 6f 20 |n handle|r or to |
|00000340| 72 65 70 6f 72 74 20 61 | 6e 20 65 72 72 6f 72 20 |report a|n error |
|00000350| 63 6f 6e 64 69 74 69 6f | 6e 20 60 6a 75 73 74 20 |conditio|n `just |
|00000360| 6c 69 6b 65 27 20 74 68 | 65 0d 73 69 74 75 61 74 |like' th|e.situat|
|00000370| 69 6f 6e 20 69 6e 20 77 | 68 69 63 68 20 74 68 65 |ion in w|hich the|
|00000380| 20 69 6e 74 65 72 70 72 | 65 74 65 72 20 72 61 69 | interpr|eter rai|
|00000390| 73 65 73 20 74 68 65 20 | 73 61 6d 65 20 65 78 63 |ses the |same exc|
|000003a0| 65 70 74 69 6f 6e 3b 20 | 62 75 74 0d 62 65 77 61 |eption; |but.bewa|
|000003b0| 72 65 20 74 68 61 74 20 | 74 68 65 72 65 20 69 73 |re that |there is|
|000003c0| 20 6e 6f 74 68 69 6e 67 | 20 74 6f 20 70 72 65 76 | nothing| to prev|
|000003d0| 65 6e 74 20 75 73 65 72 | 20 63 6f 64 65 20 66 72 |ent user| code fr|
|000003e0| 6f 6d 20 72 61 69 73 69 | 6e 67 20 61 6e 0d 69 6e |om raisi|ng an.in|
|000003f0| 61 70 70 72 6f 70 72 69 | 61 74 65 20 65 72 72 6f |appropri|ate erro|
|00000400| 72 2e 0d 0d 5c 72 65 6e | 65 77 63 6f 6d 6d 61 6e |r...\ren|ewcomman|
|00000410| 64 7b 5c 69 6e 64 65 78 | 73 75 62 69 74 65 6d 7d |d{\index|subitem}|
|00000420| 7b 28 62 75 69 6c 74 2d | 69 6e 20 65 78 63 65 70 |{(built-|in excep|
|00000430| 74 69 6f 6e 29 7d 0d 0d | 5c 62 65 67 69 6e 7b 65 |tion)}..|\begin{e|
|00000440| 78 63 64 65 73 63 7d 7b | 41 74 74 72 69 62 75 74 |xcdesc}{|Attribut|
|00000450| 65 45 72 72 6f 72 7d 0d | 25 20 78 72 65 66 20 74 |eError}.|% xref t|
|00000460| 6f 20 61 74 74 72 69 62 | 75 74 65 20 72 65 66 65 |o attrib|ute refe|
|00000470| 72 65 6e 63 65 3f 0d 20 | 20 52 61 69 73 65 64 20 |rence?. | Raised |
|00000480| 77 68 65 6e 20 61 6e 20 | 61 74 74 72 69 62 75 74 |when an |attribut|
|00000490| 65 20 72 65 66 65 72 65 | 6e 63 65 20 6f 72 20 61 |e refere|nce or a|
|000004a0| 73 73 69 67 6e 6d 65 6e | 74 20 66 61 69 6c 73 2e |ssignmen|t fails.|
|000004b0| 20 20 28 57 68 65 6e 20 | 61 6e 0d 20 20 6f 62 6a | (When |an. obj|
|000004c0| 65 63 74 20 64 6f 65 73 | 20 6e 6f 74 20 73 75 70 |ect does| not sup|
|000004d0| 70 6f 72 74 20 61 74 74 | 72 69 62 75 74 65 73 20 |port att|ributes |
|000004e0| 72 65 66 65 72 65 6e 63 | 65 73 20 6f 72 20 61 74 |referenc|es or at|
|000004f0| 74 72 69 62 75 74 65 20 | 61 73 73 69 67 6e 6d 65 |tribute |assignme|
|00000500| 6e 74 73 0d 20 20 61 74 | 20 61 6c 6c 2c 20 5c 63 |nts. at| all, \c|
|00000510| 6f 64 65 7b 54 79 70 65 | 45 72 72 6f 72 7d 20 69 |ode{Type|Error} i|
|00000520| 73 20 72 61 69 73 65 64 | 2e 29 0d 5c 65 6e 64 7b |s raised|.).\end{|
|00000530| 65 78 63 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |excdesc}|..\begin|
|00000540| 7b 65 78 63 64 65 73 63 | 7d 7b 45 4f 46 45 72 72 |{excdesc|}{EOFErr|
|00000550| 6f 72 7d 0d 25 20 58 58 | 58 4a 48 20 78 72 65 66 |or}.% XX|XJH xref|
|00000560| 73 20 68 65 72 65 0d 20 | 20 52 61 69 73 65 64 20 |s here. | Raised |
|00000570| 77 68 65 6e 20 6f 6e 65 | 20 6f 66 20 74 68 65 20 |when one| of the |
|00000580| 62 75 69 6c 74 2d 69 6e | 20 66 75 6e 63 74 69 6f |built-in| functio|
|00000590| 6e 73 20 28 5c 63 6f 64 | 65 7b 69 6e 70 75 74 28 |ns (\cod|e{input(|
|000005a0| 29 7d 20 6f 72 0d 20 20 | 5c 63 6f 64 65 7b 72 61 |)} or. |\code{ra|
|000005b0| 77 5f 69 6e 70 75 74 28 | 29 7d 29 20 68 69 74 73 |w_input(|)}) hits|
|000005c0| 20 61 6e 20 65 6e 64 2d | 6f 66 2d 66 69 6c 65 20 | an end-|of-file |
|000005d0| 63 6f 6e 64 69 74 69 6f | 6e 20 28 5c 45 4f 46 7b |conditio|n (\EOF{|
|000005e0| 7d 29 20 77 69 74 68 6f | 75 74 0d 20 20 72 65 61 |}) witho|ut. rea|
|000005f0| 64 69 6e 67 20 61 6e 79 | 20 64 61 74 61 2e 0d 25 |ding any| data..%|
|00000600| 20 58 58 58 4a 48 20 78 | 72 65 66 73 20 68 65 72 | XXXJH x|refs her|
|00000610| 65 0d 20 20 28 4e 2e 42 | 2e 3a 20 74 68 65 20 5c |e. (N.B|.: the \|
|00000620| 63 6f 64 65 7b 72 65 61 | 64 28 29 7d 20 61 6e 64 |code{rea|d()} and|
|00000630| 20 5c 63 6f 64 65 7b 72 | 65 61 64 6c 69 6e 65 28 | \code{r|eadline(|
|00000640| 29 7d 20 6d 65 74 68 6f | 64 73 20 6f 66 20 66 69 |)} metho|ds of fi|
|00000650| 6c 65 0d 20 20 6f 62 6a | 65 63 74 73 20 72 65 74 |le. obj|ects ret|
|00000660| 75 72 6e 20 61 6e 20 65 | 6d 70 74 79 20 73 74 72 |urn an e|mpty str|
|00000670| 69 6e 67 20 77 68 65 6e | 20 74 68 65 79 20 68 69 |ing when| they hi|
|00000680| 74 20 5c 45 4f 46 7b 7d | 2e 29 20 20 4e 6f 20 61 |t \EOF{}|.) No a|
|00000690| 73 73 6f 63 69 61 74 65 | 64 20 76 61 6c 75 65 2e |ssociate|d value.|
|000006a0| 0d 5c 65 6e 64 7b 65 78 | 63 64 65 73 63 7d 0d 0d |.\end{ex|cdesc}..|
|000006b0| 5c 62 65 67 69 6e 7b 65 | 78 63 64 65 73 63 7d 7b |\begin{e|xcdesc}{|
|000006c0| 49 4f 45 72 72 6f 72 7d | 0d 25 20 58 58 58 4a 48 |IOError}|.% XXXJH|
|000006d0| 20 78 72 65 66 73 20 68 | 65 72 65 0d 20 20 52 61 | xrefs h|ere. Ra|
|000006e0| 69 73 65 64 20 77 68 65 | 6e 20 61 6e 20 49 2f 4f |ised whe|n an I/O|
|000006f0| 20 6f 70 65 72 61 74 69 | 6f 6e 20 28 73 75 63 68 | operati|on (such|
|00000700| 20 61 73 20 61 20 5c 63 | 6f 64 65 7b 70 72 69 6e | as a \c|ode{prin|
|00000710| 74 7d 20 73 74 61 74 65 | 6d 65 6e 74 2c 20 74 68 |t} state|ment, th|
|00000720| 65 0d 20 20 62 75 69 6c | 74 2d 69 6e 20 5c 63 6f |e. buil|t-in \co|
|00000730| 64 65 7b 6f 70 65 6e 28 | 29 7d 20 66 75 6e 63 74 |de{open(|)} funct|
|00000740| 69 6f 6e 20 6f 72 20 61 | 20 6d 65 74 68 6f 64 20 |ion or a| method |
|00000750| 6f 66 20 61 20 66 69 6c | 65 20 6f 62 6a 65 63 74 |of a fil|e object|
|00000760| 29 20 66 61 69 6c 73 0d | 20 20 66 6f 72 20 61 6e |) fails.| for an|
|00000770| 20 49 2f 4f 2d 72 65 6c | 61 74 65 64 20 72 65 61 | I/O-rel|ated rea|
|00000780| 73 6f 6e 2c 20 65 2e 67 | 2e 2c 20 60 66 69 6c 65 |son, e.g|., `file|
|00000790| 20 6e 6f 74 20 66 6f 75 | 6e 64 27 2c 20 60 64 69 | not fou|nd', `di|
|000007a0| 73 6b 20 66 75 6c 6c 27 | 2e 0d 5c 65 6e 64 7b 65 |sk full'|..\end{e|
|000007b0| 78 63 64 65 73 63 7d 0d | 0d 5c 62 65 67 69 6e 7b |xcdesc}.|.\begin{|
|000007c0| 65 78 63 64 65 73 63 7d | 7b 49 6d 70 6f 72 74 45 |excdesc}|{ImportE|
|000007d0| 72 72 6f 72 7d 0d 25 20 | 58 58 58 4a 48 20 78 72 |rror}.% |XXXJH xr|
|000007e0| 65 66 20 74 6f 20 69 6d | 70 6f 72 74 20 73 74 61 |ef to im|port sta|
|000007f0| 74 65 6d 65 6e 74 3f 0d | 20 20 52 61 69 73 65 64 |tement?.| Raised|
|00000800| 20 77 68 65 6e 20 61 6e | 20 5c 63 6f 64 65 7b 69 | when an| \code{i|
|00000810| 6d 70 6f 72 74 7d 20 73 | 74 61 74 65 6d 65 6e 74 |mport} s|tatement|
|00000820| 20 66 61 69 6c 73 20 74 | 6f 20 66 69 6e 64 20 74 | fails t|o find t|
|00000830| 68 65 20 6d 6f 64 75 6c | 65 0d 20 20 64 65 66 69 |he modul|e. defi|
|00000840| 6e 69 74 69 6f 6e 20 6f | 72 20 77 68 65 6e 20 61 |nition o|r when a|
|00000850| 20 5c 63 6f 64 65 7b 66 | 72 6f 6d 20 7b 5c 72 6d | \code{f|rom {\rm|
|00000860| 20 5c 6c 64 6f 74 73 7d | 20 69 6d 70 6f 72 74 7d | \ldots}| import}|
|00000870| 20 66 61 69 6c 73 20 74 | 6f 20 66 69 6e 64 20 61 | fails t|o find a|
|00000880| 0d 20 20 6e 61 6d 65 20 | 74 68 61 74 20 69 73 20 |. name |that is |
|00000890| 74 6f 20 62 65 20 69 6d | 70 6f 72 74 65 64 2e 0d |to be im|ported..|
|000008a0| 5c 65 6e 64 7b 65 78 63 | 64 65 73 63 7d 0d 0d 5c |\end{exc|desc}..\|
|000008b0| 62 65 67 69 6e 7b 65 78 | 63 64 65 73 63 7d 7b 49 |begin{ex|cdesc}{I|
|000008c0| 6e 64 65 78 45 72 72 6f | 72 7d 0d 25 20 58 58 58 |ndexErro|r}.% XXX|
|000008d0| 4a 48 20 78 72 65 66 20 | 74 6f 20 73 65 71 75 65 |JH xref |to seque|
|000008e0| 6e 63 65 73 0d 20 20 52 | 61 69 73 65 64 20 77 68 |nces. R|aised wh|
|000008f0| 65 6e 20 61 20 73 65 71 | 75 65 6e 63 65 20 73 75 |en a seq|uence su|
|00000900| 62 73 63 72 69 70 74 20 | 69 73 20 6f 75 74 20 6f |bscript |is out o|
|00000910| 66 20 72 61 6e 67 65 2e | 20 20 28 53 6c 69 63 65 |f range.| (Slice|
|00000920| 20 69 6e 64 69 63 65 73 | 20 61 72 65 0d 20 20 73 | indices| are. s|
|00000930| 69 6c 65 6e 74 6c 79 20 | 74 72 75 6e 63 61 74 65 |ilently |truncate|
|00000940| 64 20 74 6f 20 66 61 6c | 6c 20 69 6e 20 74 68 65 |d to fal|l in the|
|00000950| 20 61 6c 6c 6f 77 65 64 | 20 72 61 6e 67 65 3b 20 | allowed| range; |
|00000960| 69 66 20 61 6e 20 69 6e | 64 65 78 20 69 73 20 6e |if an in|dex is n|
|00000970| 6f 74 20 61 0d 20 20 70 | 6c 61 69 6e 20 69 6e 74 |ot a. p|lain int|
|00000980| 65 67 65 72 2c 20 5c 63 | 6f 64 65 7b 54 79 70 65 |eger, \c|ode{Type|
|00000990| 45 72 72 6f 72 7d 20 69 | 73 20 72 61 69 73 65 64 |Error} i|s raised|
|000009a0| 2e 29 0d 5c 65 6e 64 7b | 65 78 63 64 65 73 63 7d |.).\end{|excdesc}|
|000009b0| 0d 0d 5c 62 65 67 69 6e | 7b 65 78 63 64 65 73 63 |..\begin|{excdesc|
|000009c0| 7d 7b 4b 65 79 45 72 72 | 6f 72 7d 0d 25 20 58 58 |}{KeyErr|or}.% XX|
|000009d0| 58 4a 48 20 78 72 65 66 | 20 74 6f 20 6d 61 70 70 |XJH xref| to mapp|
|000009e0| 69 6e 67 20 6f 62 6a 65 | 63 74 73 3f 0d 20 20 52 |ing obje|cts?. R|
|000009f0| 61 69 73 65 64 20 77 68 | 65 6e 20 61 20 6d 61 70 |aised wh|en a map|
|00000a00| 70 69 6e 67 20 28 64 69 | 63 74 69 6f 6e 61 72 79 |ping (di|ctionary|
|00000a10| 29 20 6b 65 79 20 69 73 | 20 6e 6f 74 20 66 6f 75 |) key is| not fou|
|00000a20| 6e 64 20 69 6e 20 74 68 | 65 20 73 65 74 20 6f 66 |nd in th|e set of|
|00000a30| 0d 20 20 65 78 69 73 74 | 69 6e 67 20 6b 65 79 73 |. exist|ing keys|
|00000a40| 2e 0d 5c 65 6e 64 7b 65 | 78 63 64 65 73 63 7d 0d |..\end{e|xcdesc}.|
|00000a50| 0d 5c 62 65 67 69 6e 7b | 65 78 63 64 65 73 63 7d |.\begin{|excdesc}|
|00000a60| 7b 4b 65 79 62 6f 61 72 | 64 49 6e 74 65 72 72 75 |{Keyboar|dInterru|
|00000a70| 70 74 7d 0d 20 20 52 61 | 69 73 65 64 20 77 68 65 |pt}. Ra|ised whe|
|00000a80| 6e 20 74 68 65 20 75 73 | 65 72 20 68 69 74 73 20 |n the us|er hits |
|00000a90| 74 68 65 20 69 6e 74 65 | 72 72 75 70 74 20 6b 65 |the inte|rrupt ke|
|00000aa0| 79 20 28 6e 6f 72 6d 61 | 6c 6c 79 0d 20 20 5c 6b |y (norma|lly. \k|
|00000ab0| 62 64 7b 43 6f 6e 74 72 | 6f 6c 2d 43 7d 20 6f 72 |bd{Contr|ol-C} or|
|00000ac0| 0d 5c 6b 65 79 7b 44 45 | 4c 7d 29 2e 20 20 44 75 |.\key{DE|L}). Du|
|00000ad0| 72 69 6e 67 20 65 78 65 | 63 75 74 69 6f 6e 2c 20 |ring exe|cution, |
|00000ae0| 61 20 63 68 65 63 6b 20 | 66 6f 72 20 69 6e 74 65 |a check |for inte|
|00000af0| 72 72 75 70 74 73 20 69 | 73 20 6d 61 64 65 20 72 |rrupts i|s made r|
|00000b00| 65 67 75 6c 61 72 6c 79 | 2e 0d 25 20 58 58 58 4a |egularly|..% XXXJ|
|00000b10| 48 20 78 72 65 66 73 20 | 68 65 72 65 0d 20 20 49 |H xrefs |here. I|
|00000b20| 6e 74 65 72 72 75 70 74 | 73 20 74 79 70 65 64 20 |nterrupt|s typed |
|00000b30| 77 68 65 6e 20 61 20 62 | 75 69 6c 74 2d 69 6e 20 |when a b|uilt-in |
|00000b40| 66 75 6e 63 74 69 6f 6e | 20 5c 63 6f 64 65 7b 69 |function| \code{i|
|00000b50| 6e 70 75 74 28 29 7d 20 | 6f 72 0d 20 20 5c 63 6f |nput()} |or. \co|
|00000b60| 64 65 7b 72 61 77 5f 69 | 6e 70 75 74 28 29 7d 29 |de{raw_i|nput()})|
|00000b70| 20 69 73 20 77 61 69 74 | 69 6e 67 20 66 6f 72 20 | is wait|ing for |
|00000b80| 69 6e 70 75 74 20 61 6c | 73 6f 20 72 61 69 73 65 |input al|so raise|
|00000b90| 20 74 68 69 73 20 65 78 | 63 65 70 74 69 6f 6e 2e | this ex|ception.|
|00000ba0| 20 20 4e 6f 0d 20 20 61 | 73 73 6f 63 69 61 74 65 | No. a|ssociate|
|00000bb0| 64 20 76 61 6c 75 65 2e | 0d 5c 65 6e 64 7b 65 78 |d value.|.\end{ex|
|00000bc0| 63 64 65 73 63 7d 0d 0d | 5c 62 65 67 69 6e 7b 65 |cdesc}..|\begin{e|
|00000bd0| 78 63 64 65 73 63 7d 7b | 4d 65 6d 6f 72 79 45 72 |xcdesc}{|MemoryEr|
|00000be0| 72 6f 72 7d 0d 20 20 52 | 61 69 73 65 64 20 77 68 |ror}. R|aised wh|
|00000bf0| 65 6e 20 61 6e 20 6f 70 | 65 72 61 74 69 6f 6e 20 |en an op|eration |
|00000c00| 72 75 6e 73 20 6f 75 74 | 20 6f 66 20 6d 65 6d 6f |runs out| of memo|
|00000c10| 72 79 20 62 75 74 20 74 | 68 65 20 73 69 74 75 61 |ry but t|he situa|
|00000c20| 74 69 6f 6e 20 6d 61 79 | 0d 20 20 73 74 69 6c 6c |tion may|. still|
|00000c30| 20 62 65 20 72 65 73 63 | 75 65 64 20 28 62 79 20 | be resc|ued (by |
|00000c40| 64 65 6c 65 74 69 6e 67 | 20 73 6f 6d 65 20 6f 62 |deleting| some ob|
|00000c50| 6a 65 63 74 73 29 2e 20 | 20 54 68 65 20 61 73 73 |jects). | The ass|
|00000c60| 6f 63 69 61 74 65 64 20 | 76 61 6c 75 65 20 69 73 |ociated |value is|
|00000c70| 0d 20 20 61 20 73 74 72 | 69 6e 67 20 69 6e 64 69 |. a str|ing indi|
|00000c80| 63 61 74 69 6e 67 20 77 | 68 61 74 20 6b 69 6e 64 |cating w|hat kind|
|00000c90| 20 6f 66 20 28 69 6e 74 | 65 72 6e 61 6c 29 20 6f | of (int|ernal) o|
|00000ca0| 70 65 72 61 74 69 6f 6e | 20 72 61 6e 20 6f 75 74 |peration| ran out|
|00000cb0| 20 6f 66 20 6d 65 6d 6f | 72 79 2e 0d 20 20 4e 6f | of memo|ry.. No|
|00000cc0| 74 65 20 74 68 61 74 20 | 62 65 63 61 75 73 65 20 |te that |because |
|00000cd0| 6f 66 20 74 68 65 20 75 | 6e 64 65 72 6c 79 69 6e |of the u|nderlyin|
|00000ce0| 67 20 6d 65 6d 6f 72 79 | 20 6d 61 6e 61 67 65 6d |g memory| managem|
|00000cf0| 65 6e 74 20 61 72 63 68 | 69 74 65 63 74 75 72 65 |ent arch|itecture|
|00000d00| 0d 20 20 28 5c 43 7b 7d | 27 73 20 5c 63 6f 64 65 |. (\C{}|'s \code|
|00000d10| 7b 6d 61 6c 6c 6f 63 28 | 29 7d 20 66 75 6e 63 74 |{malloc(|)} funct|
|00000d20| 69 6f 6e 29 2c 20 74 68 | 65 20 69 6e 74 65 72 70 |ion), th|e interp|
|00000d30| 72 65 74 65 72 20 6d 61 | 79 20 6e 6f 74 20 61 6c |reter ma|y not al|
|00000d40| 77 61 79 73 20 62 65 20 | 61 62 6c 65 0d 20 20 74 |ways be |able. t|
|00000d50| 6f 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 72 65 63 |o comple|tely rec|
|00000d60| 6f 76 65 72 20 66 72 6f | 6d 20 74 68 69 73 20 73 |over fro|m this s|
|00000d70| 69 74 75 61 74 69 6f 6e | 3b 20 69 74 20 6e 65 76 |ituation|; it nev|
|00000d80| 65 72 74 68 65 6c 65 73 | 73 20 72 61 69 73 65 73 |ertheles|s raises|
|00000d90| 20 61 6e 0d 20 20 65 78 | 63 65 70 74 69 6f 6e 20 | an. ex|ception |
|00000da0| 73 6f 20 74 68 61 74 20 | 61 20 73 74 61 63 6b 20 |so that |a stack |
|00000db0| 74 72 61 63 65 62 61 63 | 6b 20 63 61 6e 20 62 65 |tracebac|k can be|
|00000dc0| 20 70 72 69 6e 74 65 64 | 2c 20 69 6e 20 63 61 73 | printed|, in cas|
|00000dd0| 65 20 61 20 72 75 6e 2d | 61 77 61 79 0d 20 20 70 |e a run-|away. p|
|00000de0| 72 6f 67 72 61 6d 20 77 | 61 73 20 74 68 65 20 63 |rogram w|as the c|
|00000df0| 61 75 73 65 2e 0d 5c 65 | 6e 64 7b 65 78 63 64 65 |ause..\e|nd{excde|
|00000e00| 73 63 7d 0d 0d 5c 62 65 | 67 69 6e 7b 65 78 63 64 |sc}..\be|gin{excd|
|00000e10| 65 73 63 7d 7b 4e 61 6d | 65 45 72 72 6f 72 7d 0d |esc}{Nam|eError}.|
|00000e20| 20 20 52 61 69 73 65 64 | 20 77 68 65 6e 20 61 20 | Raised| when a |
|00000e30| 6c 6f 63 61 6c 20 6f 72 | 20 67 6c 6f 62 61 6c 20 |local or| global |
|00000e40| 6e 61 6d 65 20 69 73 20 | 6e 6f 74 20 66 6f 75 6e |name is |not foun|
|00000e50| 64 2e 20 20 54 68 69 73 | 20 61 70 70 6c 69 65 73 |d. This| applies|
|00000e60| 20 6f 6e 6c 79 0d 20 20 | 74 6f 20 75 6e 71 75 61 | only. |to unqua|
|00000e70| 6c 69 66 69 65 64 20 6e | 61 6d 65 73 2e 20 20 54 |lified n|ames. T|
|00000e80| 68 65 20 61 73 73 6f 63 | 69 61 74 65 64 20 76 61 |he assoc|iated va|
|00000e90| 6c 75 65 20 69 73 20 74 | 68 65 20 6e 61 6d 65 20 |lue is t|he name |
|00000ea0| 74 68 61 74 20 63 6f 75 | 6c 64 0d 20 20 6e 6f 74 |that cou|ld. not|
|00000eb0| 20 62 65 20 66 6f 75 6e | 64 2e 0d 5c 65 6e 64 7b | be foun|d..\end{|
|00000ec0| 65 78 63 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |excdesc}|..\begin|
|00000ed0| 7b 65 78 63 64 65 73 63 | 7d 7b 4f 76 65 72 66 6c |{excdesc|}{Overfl|
|00000ee0| 6f 77 45 72 72 6f 72 7d | 0d 25 20 58 58 58 4a 48 |owError}|.% XXXJH|
|00000ef0| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 6c 6f | referen|ce to lo|
|00000f00| 6e 67 27 73 20 61 6e 64 | 2f 6f 72 20 69 6e 74 27 |ng's and|/or int'|
|00000f10| 73 3f 0d 20 20 52 61 69 | 73 65 64 20 77 68 65 6e |s?. Rai|sed when|
|00000f20| 20 74 68 65 20 72 65 73 | 75 6c 74 20 6f 66 20 61 | the res|ult of a|
|00000f30| 6e 20 61 72 69 74 68 6d | 65 74 69 63 20 6f 70 65 |n arithm|etic ope|
|00000f40| 72 61 74 69 6f 6e 20 69 | 73 20 74 6f 6f 20 6c 61 |ration i|s too la|
|00000f50| 72 67 65 20 74 6f 20 62 | 65 0d 20 20 72 65 70 72 |rge to b|e. repr|
|00000f60| 65 73 65 6e 74 65 64 2e | 20 20 54 68 69 73 20 63 |esented.| This c|
|00000f70| 61 6e 6e 6f 74 20 6f 63 | 63 75 72 20 66 6f 72 20 |annot oc|cur for |
|00000f80| 6c 6f 6e 67 20 69 6e 74 | 65 67 65 72 73 20 28 77 |long int|egers (w|
|00000f90| 68 69 63 68 20 77 6f 75 | 6c 64 20 72 61 74 68 65 |hich wou|ld rathe|
|00000fa0| 72 0d 20 20 72 61 69 73 | 65 20 5c 63 6f 64 65 7b |r. rais|e \code{|
|00000fb0| 4d 65 6d 6f 72 79 45 72 | 72 6f 72 7d 20 74 68 61 |MemoryEr|ror} tha|
|00000fc0| 6e 20 67 69 76 65 20 75 | 70 29 2e 20 20 42 65 63 |n give u|p). Bec|
|00000fd0| 61 75 73 65 20 6f 66 20 | 74 68 65 20 6c 61 63 6b |ause of |the lack|
|00000fe0| 20 6f 66 0d 20 20 73 74 | 61 6e 64 61 72 64 69 7a | of. st|andardiz|
|00000ff0| 61 74 69 6f 6e 20 6f 66 | 20 66 6c 6f 61 74 69 6e |ation of| floatin|
|00001000| 67 20 70 6f 69 6e 74 20 | 65 78 63 65 70 74 69 6f |g point |exceptio|
|00001010| 6e 20 68 61 6e 64 6c 69 | 6e 67 20 69 6e 20 5c 43 |n handli|ng in \C|
|00001020| 7b 7d 2c 20 6d 6f 73 74 | 0d 20 20 66 6c 6f 61 74 |{}, most|. float|
|00001030| 69 6e 67 20 70 6f 69 6e | 74 20 6f 70 65 72 61 74 |ing poin|t operat|
|00001040| 69 6f 6e 73 20 61 6c 73 | 6f 20 61 72 65 6e 27 74 |ions als|o aren't|
|00001050| 20 63 68 65 63 6b 65 64 | 2e 20 20 46 6f 72 20 70 | checked|. For p|
|00001060| 6c 61 69 6e 20 69 6e 74 | 65 67 65 72 73 2c 0d 20 |lain int|egers,. |
|00001070| 20 61 6c 6c 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 | all ope|rations |
|00001080| 74 68 61 74 20 63 61 6e | 20 6f 76 65 72 66 6c 6f |that can| overflo|
|00001090| 77 20 61 72 65 20 63 68 | 65 63 6b 65 64 20 65 78 |w are ch|ecked ex|
|000010a0| 63 65 70 74 20 6c 65 66 | 74 20 73 68 69 66 74 2c |cept lef|t shift,|
|000010b0| 20 77 68 65 72 65 0d 20 | 20 74 79 70 69 63 61 6c | where. | typical|
|000010c0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 70 72 | applica|tions pr|
|000010d0| 65 66 65 72 20 74 6f 20 | 64 72 6f 70 20 62 69 74 |efer to |drop bit|
|000010e0| 73 20 74 68 61 6e 20 72 | 61 69 73 65 20 61 6e 20 |s than r|aise an |
|000010f0| 65 78 63 65 70 74 69 6f | 6e 2e 0d 5c 65 6e 64 7b |exceptio|n..\end{|
|00001100| 65 78 63 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |excdesc}|..\begin|
|00001110| 7b 65 78 63 64 65 73 63 | 7d 7b 52 75 6e 74 69 6d |{excdesc|}{Runtim|
|00001120| 65 45 72 72 6f 72 7d 0d | 20 20 52 61 69 73 65 64 |eError}.| Raised|
|00001130| 20 77 68 65 6e 20 61 6e | 20 65 72 72 6f 72 20 69 | when an| error i|
|00001140| 73 20 64 65 74 65 63 74 | 65 64 20 74 68 61 74 20 |s detect|ed that |
|00001150| 64 6f 65 73 6e 27 74 20 | 66 61 6c 6c 20 69 6e 20 |doesn't |fall in |
|00001160| 61 6e 79 20 6f 66 20 74 | 68 65 0d 20 20 6f 74 68 |any of t|he. oth|
|00001170| 65 72 20 63 61 74 65 67 | 6f 72 69 65 73 2e 20 20 |er categ|ories. |
|00001180| 54 68 65 20 61 73 73 6f | 63 69 61 74 65 64 20 76 |The asso|ciated v|
|00001190| 61 6c 75 65 20 69 73 20 | 61 20 73 74 72 69 6e 67 |alue is |a string|
|000011a0| 20 69 6e 64 69 63 61 74 | 69 6e 67 20 77 68 61 74 | indicat|ing what|
|000011b0| 0d 20 20 70 72 65 63 69 | 73 65 6c 79 20 77 65 6e |. preci|sely wen|
|000011c0| 74 20 77 72 6f 6e 67 2e | 20 20 28 54 68 69 73 20 |t wrong.| (This |
|000011d0| 65 78 63 65 70 74 69 6f | 6e 20 69 73 20 61 20 72 |exceptio|n is a r|
|000011e0| 65 6c 69 63 20 66 72 6f | 6d 20 61 20 70 72 65 76 |elic fro|m a prev|
|000011f0| 69 6f 75 73 0d 20 20 76 | 65 72 73 69 6f 6e 20 6f |ious. v|ersion o|
|00001200| 66 20 74 68 65 20 69 6e | 74 65 72 70 72 65 74 65 |f the in|terprete|
|00001210| 72 3b 20 69 74 20 69 73 | 20 6e 6f 74 20 75 73 65 |r; it is| not use|
|00001220| 64 20 61 6e 79 20 6d 6f | 72 65 20 65 78 63 65 70 |d any mo|re excep|
|00001230| 74 20 62 79 20 73 6f 6d | 65 0d 20 20 65 78 74 65 |t by som|e. exte|
|00001240| 6e 73 69 6f 6e 20 6d 6f | 64 75 6c 65 73 20 74 68 |nsion mo|dules th|
|00001250| 61 74 20 68 61 76 65 6e | 27 74 20 62 65 65 6e 20 |at haven|'t been |
|00001260| 63 6f 6e 76 65 72 74 65 | 64 20 74 6f 20 64 65 66 |converte|d to def|
|00001270| 69 6e 65 20 74 68 65 69 | 72 20 6f 77 6e 0d 20 20 |ine thei|r own. |
|00001280| 65 78 63 65 70 74 69 6f | 6e 73 20 79 65 74 2e 29 |exceptio|ns yet.)|
|00001290| 0d 5c 65 6e 64 7b 65 78 | 63 64 65 73 63 7d 0d 0d |.\end{ex|cdesc}..|
|000012a0| 5c 62 65 67 69 6e 7b 65 | 78 63 64 65 73 63 7d 7b |\begin{e|xcdesc}{|
|000012b0| 53 79 6e 74 61 78 45 72 | 72 6f 72 7d 0d 25 20 58 |SyntaxEr|ror}.% X|
|000012c0| 58 58 4a 48 20 78 72 65 | 66 20 74 6f 20 74 68 65 |XXJH xre|f to the|
|000012d0| 73 65 20 66 75 6e 63 74 | 69 6f 6e 73 3f 0d 20 20 |se funct|ions?. |
|000012e0| 52 61 69 73 65 64 20 77 | 68 65 6e 20 74 68 65 20 |Raised w|hen the |
|000012f0| 70 61 72 73 65 72 20 65 | 6e 63 6f 75 6e 74 65 72 |parser e|ncounter|
|00001300| 73 20 61 20 73 79 6e 74 | 61 78 20 65 72 72 6f 72 |s a synt|ax error|
|00001310| 2e 20 20 54 68 69 73 20 | 6d 61 79 20 6f 63 63 75 |. This |may occu|
|00001320| 72 20 69 6e 0d 20 20 61 | 6e 20 5c 63 6f 64 65 7b |r in. a|n \code{|
|00001330| 69 6d 70 6f 72 74 7d 20 | 73 74 61 74 65 6d 65 6e |import} |statemen|
|00001340| 74 2c 20 69 6e 20 61 6e | 20 5c 63 6f 64 65 7b 65 |t, in an| \code{e|
|00001350| 78 65 63 7d 20 73 74 61 | 74 65 6d 65 6e 74 2c 20 |xec} sta|tement, |
|00001360| 69 6e 20 61 20 63 61 6c | 6c 0d 20 20 74 6f 20 74 |in a cal|l. to t|
|00001370| 68 65 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 |he built|-in func|
|00001380| 74 69 6f 6e 20 5c 63 6f | 64 65 7b 65 76 61 6c 28 |tion \co|de{eval(|
|00001390| 29 7d 20 6f 72 20 5c 63 | 6f 64 65 7b 69 6e 70 75 |)} or \c|ode{inpu|
|000013a0| 74 28 29 7d 2c 20 6f 72 | 0d 20 20 77 68 65 6e 20 |t()}, or|. when |
|000013b0| 72 65 61 64 69 6e 67 20 | 74 68 65 20 69 6e 69 74 |reading |the init|
|000013c0| 69 61 6c 20 73 63 72 69 | 70 74 20 6f 72 20 73 74 |ial scri|pt or st|
|000013d0| 61 6e 64 61 72 64 20 69 | 6e 70 75 74 20 28 61 6c |andard i|nput (al|
|000013e0| 73 6f 0d 20 20 69 6e 74 | 65 72 61 63 74 69 76 65 |so. int|eractive|
|000013f0| 6c 79 29 2e 0d 5c 65 6e | 64 7b 65 78 63 64 65 73 |ly)..\en|d{excdes|
|00001400| 63 7d 0d 0d 5c 62 65 67 | 69 6e 7b 65 78 63 64 65 |c}..\beg|in{excde|
|00001410| 73 63 7d 7b 53 79 73 74 | 65 6d 45 72 72 6f 72 7d |sc}{Syst|emError}|
|00001420| 0d 20 20 52 61 69 73 65 | 64 20 77 68 65 6e 20 74 |. Raise|d when t|
|00001430| 68 65 20 69 6e 74 65 72 | 70 72 65 74 65 72 20 66 |he inter|preter f|
|00001440| 69 6e 64 73 20 61 6e 20 | 69 6e 74 65 72 6e 61 6c |inds an |internal|
|00001450| 20 65 72 72 6f 72 2c 20 | 62 75 74 20 74 68 65 0d | error, |but the.|
|00001460| 20 20 73 69 74 75 61 74 | 69 6f 6e 20 64 6f 65 73 | situat|ion does|
|00001470| 20 6e 6f 74 20 6c 6f 6f | 6b 20 73 6f 20 73 65 72 | not loo|k so ser|
|00001480| 69 6f 75 73 20 74 6f 20 | 63 61 75 73 65 20 69 74 |ious to |cause it|
|00001490| 20 74 6f 20 61 62 61 6e | 64 6f 6e 20 61 6c 6c 20 | to aban|don all |
|000014a0| 68 6f 70 65 2e 0d 20 20 | 54 68 65 20 61 73 73 6f |hope.. |The asso|
|000014b0| 63 69 61 74 65 64 20 76 | 61 6c 75 65 20 69 73 20 |ciated v|alue is |
|000014c0| 61 20 73 74 72 69 6e 67 | 20 69 6e 64 69 63 61 74 |a string| indicat|
|000014d0| 69 6e 67 20 77 68 61 74 | 20 77 65 6e 74 20 77 72 |ing what| went wr|
|000014e0| 6f 6e 67 20 28 69 6e 0d | 20 20 6c 6f 77 2d 6c 65 |ong (in.| low-le|
|000014f0| 76 65 6c 20 74 65 72 6d | 73 29 2e 0d 20 20 0d 20 |vel term|s).. . |
|00001500| 20 59 6f 75 20 73 68 6f | 75 6c 64 20 72 65 70 6f | You sho|uld repo|
|00001510| 72 74 20 74 68 69 73 20 | 74 6f 20 74 68 65 20 61 |rt this |to the a|
|00001520| 75 74 68 6f 72 20 6f 72 | 20 6d 61 69 6e 74 61 69 |uthor or| maintai|
|00001530| 6e 65 72 20 6f 66 20 79 | 6f 75 72 20 50 79 74 68 |ner of y|our Pyth|
|00001540| 6f 6e 0d 20 20 69 6e 74 | 65 72 70 72 65 74 65 72 |on. int|erpreter|
|00001550| 2e 20 20 42 65 20 73 75 | 72 65 20 74 6f 20 72 65 |. Be su|re to re|
|00001560| 70 6f 72 74 20 74 68 65 | 20 76 65 72 73 69 6f 6e |port the| version|
|00001570| 20 73 74 72 69 6e 67 20 | 6f 66 20 74 68 65 20 50 | string |of the P|
|00001580| 79 74 68 6f 6e 0d 20 20 | 69 6e 74 65 72 70 72 65 |ython. |interpre|
|00001590| 74 65 72 20 28 5c 63 6f | 64 65 7b 73 79 73 2e 76 |ter (\co|de{sys.v|
|000015a0| 65 72 73 69 6f 6e 7d 3b | 20 69 74 20 69 73 20 61 |ersion};| it is a|
|000015b0| 6c 73 6f 20 70 72 69 6e | 74 65 64 20 61 74 20 74 |lso prin|ted at t|
|000015c0| 68 65 20 73 74 61 72 74 | 20 6f 66 20 61 6e 0d 20 |he start| of an. |
|000015d0| 20 69 6e 74 65 72 61 63 | 74 69 76 65 20 50 79 74 | interac|tive Pyt|
|000015e0| 68 6f 6e 20 73 65 73 73 | 69 6f 6e 29 2c 20 74 68 |hon sess|ion), th|
|000015f0| 65 20 65 78 61 63 74 20 | 65 72 72 6f 72 20 6d 65 |e exact |error me|
|00001600| 73 73 61 67 65 20 28 74 | 68 65 20 65 78 63 65 70 |ssage (t|he excep|
|00001610| 74 69 6f 6e 27 73 0d 20 | 20 61 73 73 6f 63 69 61 |tion's. | associa|
|00001620| 74 65 64 20 76 61 6c 75 | 65 29 20 61 6e 64 20 69 |ted valu|e) and i|
|00001630| 66 20 70 6f 73 73 69 62 | 6c 65 20 74 68 65 20 73 |f possib|le the s|
|00001640| 6f 75 72 63 65 20 6f 66 | 20 74 68 65 20 70 72 6f |ource of| the pro|
|00001650| 67 72 61 6d 20 74 68 61 | 74 0d 20 20 74 72 69 67 |gram tha|t. trig|
|00001660| 67 65 72 65 64 20 74 68 | 65 20 65 72 72 6f 72 2e |gered th|e error.|
|00001670| 0d 5c 65 6e 64 7b 65 78 | 63 64 65 73 63 7d 0d 0d |.\end{ex|cdesc}..|
|00001680| 5c 62 65 67 69 6e 7b 65 | 78 63 64 65 73 63 7d 7b |\begin{e|xcdesc}{|
|00001690| 53 79 73 74 65 6d 45 78 | 69 74 7d 0d 25 20 58 58 |SystemEx|it}.% XX|
|000016a0| 58 4a 48 20 78 72 65 66 | 20 74 6f 20 6d 6f 64 75 |XJH xref| to modu|
|000016b0| 6c 65 20 73 79 73 3f 0d | 20 20 54 68 69 73 20 65 |le sys?.| This e|
|000016c0| 78 63 65 70 74 69 6f 6e | 20 69 73 20 72 61 69 73 |xception| is rais|
|000016d0| 65 64 20 62 79 20 74 68 | 65 20 5c 63 6f 64 65 7b |ed by th|e \code{|
|000016e0| 73 79 73 2e 65 78 69 74 | 28 29 7d 20 66 75 6e 63 |sys.exit|()} func|
|000016f0| 74 69 6f 6e 2e 20 20 57 | 68 65 6e 20 69 74 0d 20 |tion. W|hen it. |
|00001700| 20 69 73 20 6e 6f 74 20 | 68 61 6e 64 6c 65 64 2c | is not |handled,|
|00001710| 20 74 68 65 20 50 79 74 | 68 6f 6e 20 69 6e 74 65 | the Pyt|hon inte|
|00001720| 72 70 72 65 74 65 72 20 | 65 78 69 74 73 3b 20 6e |rpreter |exits; n|
|00001730| 6f 20 73 74 61 63 6b 20 | 74 72 61 63 65 62 61 63 |o stack |tracebac|
|00001740| 6b 20 69 73 0d 20 20 70 | 72 69 6e 74 65 64 2e 20 |k is. p|rinted. |
|00001750| 20 49 66 20 74 68 65 20 | 61 73 73 6f 63 69 61 74 | If the |associat|
|00001760| 65 64 20 76 61 6c 75 65 | 20 69 73 20 61 20 70 6c |ed value| is a pl|
|00001770| 61 69 6e 20 69 6e 74 65 | 67 65 72 2c 20 69 74 20 |ain inte|ger, it |
|00001780| 73 70 65 63 69 66 69 65 | 73 20 74 68 65 0d 20 20 |specifie|s the. |
|00001790| 73 79 73 74 65 6d 20 65 | 78 69 74 20 73 74 61 74 |system e|xit stat|
|000017a0| 75 73 20 28 70 61 73 73 | 65 64 20 74 6f 20 5c 43 |us (pass|ed to \C|
|000017b0| 7b 7d 27 73 20 5c 63 6f | 64 65 7b 65 78 69 74 28 |{}'s \co|de{exit(|
|000017c0| 29 7d 20 66 75 6e 63 74 | 69 6f 6e 29 3b 20 69 66 |)} funct|ion); if|
|000017d0| 20 69 74 20 69 73 0d 20 | 20 5c 63 6f 64 65 7b 4e | it is. | \code{N|
|000017e0| 6f 6e 65 7d 2c 20 74 68 | 65 20 65 78 69 74 20 73 |one}, th|e exit s|
|000017f0| 74 61 74 75 73 20 69 73 | 20 7a 65 72 6f 3b 20 69 |tatus is| zero; i|
|00001800| 66 20 69 74 20 68 61 73 | 20 61 6e 6f 74 68 65 72 |f it has| another|
|00001810| 20 74 79 70 65 20 28 73 | 75 63 68 20 61 73 0d 20 | type (s|uch as. |
|00001820| 20 61 20 73 74 72 69 6e | 67 29 2c 20 74 68 65 20 | a strin|g), the |
|00001830| 6f 62 6a 65 63 74 27 73 | 20 76 61 6c 75 65 20 69 |object's| value i|
|00001840| 73 20 70 72 69 6e 74 65 | 64 20 61 6e 64 20 74 68 |s printe|d and th|
|00001850| 65 20 65 78 69 74 20 73 | 74 61 74 75 73 20 69 73 |e exit s|tatus is|
|00001860| 20 6f 6e 65 2e 0d 20 20 | 0d 20 20 41 20 63 61 6c | one.. |. A cal|
|00001870| 6c 20 74 6f 20 5c 63 6f | 64 65 7b 73 79 73 2e 65 |l to \co|de{sys.e|
|00001880| 78 69 74 7d 20 69 73 20 | 74 72 61 6e 73 6c 61 74 |xit} is |translat|
|00001890| 65 64 20 69 6e 74 6f 20 | 61 6e 20 65 78 63 65 70 |ed into |an excep|
|000018a0| 74 69 6f 6e 20 73 6f 20 | 74 68 61 74 0d 20 20 63 |tion so |that. c|
|000018b0| 6c 65 61 6e 2d 75 70 20 | 68 61 6e 64 6c 65 72 73 |lean-up |handlers|
|000018c0| 20 28 5c 63 6f 64 65 7b | 66 69 6e 61 6c 6c 79 7d | (\code{|finally}|
|000018d0| 20 63 6c 61 75 73 65 73 | 20 6f 66 20 5c 63 6f 64 | clauses| of \cod|
|000018e0| 65 7b 74 72 79 7d 20 73 | 74 61 74 65 6d 65 6e 74 |e{try} s|tatement|
|000018f0| 73 29 0d 20 20 63 61 6e | 20 62 65 20 65 78 65 63 |s). can| be exec|
|00001900| 75 74 65 64 2c 20 61 6e | 64 20 73 6f 20 74 68 61 |uted, an|d so tha|
|00001910| 74 20 61 20 64 65 62 75 | 67 67 65 72 20 63 61 6e |t a debu|gger can|
|00001920| 20 65 78 65 63 75 74 65 | 20 61 20 73 63 72 69 70 | execute| a scrip|
|00001930| 74 20 77 69 74 68 6f 75 | 74 0d 20 20 72 75 6e 6e |t withou|t. runn|
|00001940| 69 6e 67 20 74 68 65 20 | 72 69 73 6b 20 6f 66 20 |ing the |risk of |
|00001950| 6c 6f 73 69 6e 67 20 63 | 6f 6e 74 72 6f 6c 2e 20 |losing c|ontrol. |
|00001960| 20 54 68 65 20 5c 63 6f | 64 65 7b 70 6f 73 69 78 | The \co|de{posix|
|00001970| 2e 5f 65 78 69 74 28 29 | 7d 20 66 75 6e 63 74 69 |._exit()|} functi|
|00001980| 6f 6e 0d 20 20 63 61 6e | 20 62 65 20 75 73 65 64 |on. can| be used|
|00001990| 20 69 66 20 69 74 20 69 | 73 20 61 62 73 6f 6c 75 | if it i|s absolu|
|000019a0| 74 65 6c 79 20 70 6f 73 | 69 74 69 76 65 6c 79 20 |tely pos|itively |
|000019b0| 6e 65 63 65 73 73 61 72 | 79 20 74 6f 20 65 78 69 |necessar|y to exi|
|000019c0| 74 0d 20 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |t. imme|diately |
|000019d0| 28 65 2e 67 2e 2c 20 61 | 66 74 65 72 20 61 20 5c |(e.g., a|fter a \|
|000019e0| 63 6f 64 65 7b 66 6f 72 | 6b 28 29 7d 20 69 6e 20 |code{for|k()} in |
|000019f0| 74 68 65 20 63 68 69 6c | 64 20 70 72 6f 63 65 73 |the chil|d proces|
|00001a00| 73 29 2e 0d 5c 65 6e 64 | 7b 65 78 63 64 65 73 63 |s)..\end|{excdesc|
|00001a10| 7d 0d 0d 5c 62 65 67 69 | 6e 7b 65 78 63 64 65 73 |}..\begi|n{excdes|
|00001a20| 63 7d 7b 54 79 70 65 45 | 72 72 6f 72 7d 0d 20 20 |c}{TypeE|rror}. |
|00001a30| 52 61 69 73 65 64 20 77 | 68 65 6e 20 61 20 62 75 |Raised w|hen a bu|
|00001a40| 69 6c 74 2d 69 6e 20 6f | 70 65 72 61 74 69 6f 6e |ilt-in o|peration|
|00001a50| 20 6f 72 20 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 | or func|tion is |
|00001a60| 61 70 70 6c 69 65 64 20 | 74 6f 20 61 6e 20 6f 62 |applied |to an ob|
|00001a70| 6a 65 63 74 0d 20 20 6f | 66 20 69 6e 61 70 70 72 |ject. o|f inappr|
|00001a80| 6f 70 72 69 61 74 65 20 | 74 79 70 65 2e 20 20 54 |opriate |type. T|
|00001a90| 68 65 20 61 73 73 6f 63 | 69 61 74 65 64 20 76 61 |he assoc|iated va|
|00001aa0| 6c 75 65 20 69 73 20 61 | 20 73 74 72 69 6e 67 20 |lue is a| string |
|00001ab0| 67 69 76 69 6e 67 0d 20 | 20 64 65 74 61 69 6c 73 |giving. | details|
|00001ac0| 20 61 62 6f 75 74 20 74 | 68 65 20 74 79 70 65 20 | about t|he type |
|00001ad0| 6d 69 73 6d 61 74 63 68 | 2e 0d 5c 65 6e 64 7b 65 |mismatch|..\end{e|
|00001ae0| 78 63 64 65 73 63 7d 0d | 0d 5c 62 65 67 69 6e 7b |xcdesc}.|.\begin{|
|00001af0| 65 78 63 64 65 73 63 7d | 7b 56 61 6c 75 65 45 72 |excdesc}|{ValueEr|
|00001b00| 72 6f 72 7d 0d 20 20 52 | 61 69 73 65 64 20 77 68 |ror}. R|aised wh|
|00001b10| 65 6e 20 61 20 62 75 69 | 6c 74 2d 69 6e 20 6f 70 |en a bui|lt-in op|
|00001b20| 65 72 61 74 69 6f 6e 20 | 6f 72 20 66 75 6e 63 74 |eration |or funct|
|00001b30| 69 6f 6e 20 72 65 63 65 | 69 76 65 73 20 61 6e 20 |ion rece|ives an |
|00001b40| 61 72 67 75 6d 65 6e 74 | 0d 20 20 74 68 61 74 20 |argument|. that |
|00001b50| 68 61 73 20 74 68 65 20 | 72 69 67 68 74 20 74 79 |has the |right ty|
|00001b60| 70 65 20 62 75 74 20 61 | 6e 20 69 6e 61 70 70 72 |pe but a|n inappr|
|00001b70| 6f 70 72 69 61 74 65 20 | 76 61 6c 75 65 2c 20 61 |opriate |value, a|
|00001b80| 6e 64 20 74 68 65 0d 20 | 20 73 69 74 75 61 74 69 |nd the. | situati|
|00001b90| 6f 6e 20 69 73 20 6e 6f | 74 20 64 65 73 63 72 69 |on is no|t descri|
|00001ba0| 62 65 64 20 62 79 20 61 | 20 6d 6f 72 65 20 70 72 |bed by a| more pr|
|00001bb0| 65 63 69 73 65 20 65 78 | 63 65 70 74 69 6f 6e 20 |ecise ex|ception |
|00001bc0| 73 75 63 68 20 61 73 0d | 20 20 5c 63 6f 64 65 7b |such as.| \code{|
|00001bd0| 49 6e 64 65 78 45 72 72 | 6f 72 7d 2e 0d 5c 65 6e |IndexErr|or}..\en|
|00001be0| 64 7b 65 78 63 64 65 73 | 63 7d 0d 0d 5c 62 65 67 |d{excdes|c}..\beg|
|00001bf0| 69 6e 7b 65 78 63 64 65 | 73 63 7d 7b 5a 65 72 6f |in{excde|sc}{Zero|
|00001c00| 44 69 76 69 73 69 6f 6e | 45 72 72 6f 72 7d 0d 20 |Division|Error}. |
|00001c10| 20 52 61 69 73 65 64 20 | 77 68 65 6e 20 74 68 65 | Raised |when the|
|00001c20| 20 73 65 63 6f 6e 64 20 | 61 72 67 75 6d 65 6e 74 | second |argument|
|00001c30| 20 6f 66 20 61 20 64 69 | 76 69 73 69 6f 6e 20 6f | of a di|vision o|
|00001c40| 72 20 6d 6f 64 75 6c 6f | 20 6f 70 65 72 61 74 69 |r modulo| operati|
|00001c50| 6f 6e 20 69 73 0d 20 20 | 7a 65 72 6f 2e 20 20 54 |on is. |zero. T|
|00001c60| 68 65 20 61 73 73 6f 63 | 69 61 74 65 64 20 76 61 |he assoc|iated va|
|00001c70| 6c 75 65 20 69 73 20 61 | 20 73 74 72 69 6e 67 20 |lue is a| string |
|00001c80| 69 6e 64 69 63 61 74 69 | 6e 67 20 74 68 65 20 74 |indicati|ng the t|
|00001c90| 79 70 65 20 6f 66 20 74 | 68 65 0d 20 20 6f 70 65 |ype of t|he. ope|
|00001ca0| 72 61 6e 64 73 20 61 6e | 64 20 74 68 65 20 6f 70 |rands an|d the op|
|00001cb0| 65 72 61 74 69 6f 6e 2e | 0d 5c 65 6e 64 7b 65 78 |eration.|.\end{ex|
|00001cc0| 63 64 65 73 63 7d 0d | |cdesc}. | |
+--------+-------------------------+-------------------------+--------+--------+